package Object;

public class lianjie {
    public static void main(String[] args) {
        String path = "http://localhost:8080/myweb/red?name=zhangsan&pwd=123456&nick=san&age=16";
        String [] arr= path.split("\\?");
        System.out.println("请求"+arr[0]);
        System.out.println("参数"+arr[1]);
//拆分出每个参数，按照&划分
        arr = arr[1].split("&");//[name=zhangsan,pwd=123456,......]
//遍历出每个参数
        for(int i = 0;i<arr.length;i++){
            String Line= arr[i];
//再将每个参数按照 "="拆分为参数名和参数值
            String [] data = arr[i].split("=");
            System.out.println("参数名"+data[0]+",参数值:"+data[1]);
        }
    }
}
